//
// Ishtar C++ Utility Library
//
// Task Facility - Worker Thread Header
//

#ifndef __ISHTAR_TASK_WORKER_THREAD_H
#define __ISHTAR_TASK_WORKER_THREAD_H

#include <Ishtar/Ishtar.h>

#if defined( ISHTAR_COMPILER_HAS_PRAGMA_ONCE )
#pragma once
#endif

#include <boost/noncopyable.hpp>
#include <Ishtar/Task/WorkExecutor.h>


namespace Ishtar
{

namespace Task
{

///////////////////////////////////////////////////////////////////////////////
//
// Worker Thread
//

class WorkerThreadImpl;

class WorkerThread : public WorkExecutor
                   , public boost::noncopyable
{
public:

    WorkerThread();
    ~WorkerThread();

    //
    // Shutdown
    //

    void Startup( const std::string& name );
    void Shutdown();


    //
    // Submitting Works
    //

    void Submit( const Work& w );

    using WorkExecutor::SubmitWork;


    /// properties about works ///

    Uint GetNumWorks()      const;
    Uint GetNumReadyWorks() const;


private:

    boost::scoped_ptr< WorkerThreadImpl > m_impl;
};


///////////////////////////////////////////////////////////////////////////////

} // namespace Task

} // namespace Ishtar

#endif // __ISHTAR_TASK_WORKER_THREAD_H
